package com.example.administrator.basedemos.adapter;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.administrator.basedemos.R;
import com.example.administrator.basedemos.bean.MutliSearchBean;
import com.example.administrator.basedemos.utils.Constants;

import java.util.List;

/**
 * 创建者     ZCL
 * 创建时间   2018/7/30 14:18
 * 描述	      ${TODO}
 * <p>
 * 更新者     $Author$
 * 更新时间   $Date$
 * 更新描述   ${TODO}
 */
public class MultiThanAdapter extends BaseMultiItemQuickAdapter<MutliSearchBean, BaseViewHolder> {

    /**
     * 使用该类时必须要绑定对应的view
     * 也就是list里面有几个type类型就必须设置几个view
     * 否则会报资源空指针
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public MultiThanAdapter(List<MutliSearchBean> data) {
        super(data);
        addItemType(Constants.search_flow, R.layout.item_than_info);
        addItemType(Constants.popular_currency, R.layout.item_than_url);
        //addItemType(Constants.hot_exchange, R.layout.item_recomend);
        //addItemType(Constants.search_flow, R.layout.flow_vg);
        //addItemType(Constants.popular_currency, R.layout.template_recycleview_with_title_nob);
        // addItemType(Constants.hot_exchange, R.layout.template_recycleview_with_title_nob);
    }

    @Override
    protected void convert(BaseViewHolder helper, MutliSearchBean item) {
        switch (item.getItemType()) {
            case 0:
                helper.setText(R.id.item_zhan_info_info, "456名")
                        .setText(R.id.item_zhan_info_info, "流通市值");
                break;
            case 1:
                //helper.setText(R.id.item_zhan_info_info,"6名")
                //        .setText(R.id.item_zhan_info_info,"流通时间");
                break;
            default:
                break;
        }
    }
}
